home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Portable Patmos / usr / include / machine / scsi_5380.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-08  |  5.0 KB  |  158 lines  |  [TEXT/R*ch]

  1. /*
  2.  * Mach Operating System
  3.  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie the
  24.  * rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log: scsi_5380.h,v $
  29.  * Revision 1.2  1993/11/29  00:38:38  briggs
  30.  * Added signal.h for -current.  The rest is formatting changes.
  31.  *
  32.  * Revision 2.3  91/08/24  12:25:10  af
  33.  *     Moved padding of regmap in impl file.
  34.  *     [91/08/02  04:22:39  af]
  35.  * 
  36.  * Revision 2.2  91/06/19  16:28:35  rvb
  37.  *     From the NCR data sheets
  38.  *     "NCR 5380 Family, SCSI Protocol Controller Data Manual"
  39.  *     NCR Microelectronics Division, Colorado Spring, 6/98 T01891L
  40.  *     [91/04/21            af]
  41.  * 
  42.  */
  43. /*
  44.  *    File: scsi_5380.h
  45.  *     Author: Alessandro Forin, Carnegie Mellon University
  46.  *    Date:    5/91
  47.  *
  48.  *    Defines for the NCR 5380 (SCSI chip), aka Am5380
  49.  */
  50.  
  51. /*
  52.  * Register map
  53.  */
  54.  
  55. typedef struct {
  56.     volatile unsigned char sci_data;    /* r:  Current data */
  57. #define    sci_odata sci_data            /* w:  Out data */
  58.     PAD(pad0);
  59.  
  60.     volatile unsigned char sci_icmd;    /* rw: Initiator command */
  61.     PAD(pad1);
  62.  
  63.     volatile unsigned char sci_mode;    /* rw: Mode */
  64.     PAD(pad2);
  65.  
  66.     volatile unsigned char sci_tcmd;    /* rw: Target command */
  67.     PAD(pad3);
  68.  
  69.     volatile unsigned char sci_bus_csr;    /* r:  Bus Status */
  70. #define    sci_sel_enb sci_bus_csr            /* w:  Select enable */
  71.     PAD(pad4);
  72.  
  73.     volatile unsigned char sci_csr;        /* r:  Status */
  74. #define    sci_dma_send sci_csr            /* w:  Start dma send data */
  75.     PAD(pad5);
  76.  
  77.     volatile unsigned char sci_idata;    /* r:  Input data */
  78. #define    sci_trecv sci_idata            /* w:  Start dma receive, target */
  79.     PAD(pad6);
  80.  
  81.     volatile unsigned char sci_iack;    /* r:  Interrupt Acknowledge  */
  82. #define    sci_irecv sci_iack            /* w:  Start dma receive, initiator */
  83. } sci_regmap_t;
  84.  
  85.  
  86. /*
  87.  * Initiator command register
  88.  */
  89.  
  90. #define SCI_ICMD_DATA        0x01        /* rw: Assert data bus   */
  91. #define SCI_ICMD_ATN        0x02        /* rw: Assert ATN signal */
  92. #define SCI_ICMD_SEL        0x04        /* rw: Assert SEL signal */
  93. #define SCI_ICMD_BSY        0x08        /* rw: Assert BSY signal */
  94. #define SCI_ICMD_ACK        0x10        /* rw: Assert ACK signal */
  95. #define SCI_ICMD_LST        0x20        /* r:  Lost arbitration */
  96. #define SCI_ICMD_DIFF    SCI_ICMD_LST        /* w:  Differential cable */
  97. #define SCI_ICMD_AIP        0x40        /* r:  Arbitration in progress */
  98. #define SCI_ICMD_TEST    SCI_ICMD_AIP        /* w:  Test mode */
  99. #define SCI_ICMD_RST        0x80        /* rw: Assert RST signal */
  100.  
  101.  
  102. /*
  103.  * Mode register
  104.  */
  105.  
  106. #define SCI_MODE_ARB        0x01        /* rw: Start arbitration */
  107. #define SCI_MODE_DMA        0x02        /* rw: Enable DMA xfers */
  108. #define SCI_MODE_MONBSY        0x04        /* rw: Monitor BSY signal */
  109. #define SCI_MODE_DMA_IE        0x08        /* rw: Enable DMA complete interrupt */
  110. #define SCI_MODE_PERR_IE    0x10        /* rw: Interrupt on parity errors */
  111. #define SCI_MODE_PAR_CHK    0x20        /* rw: Check parity */
  112. #define SCI_MODE_TARGET        0x40        /* rw: Target mode (Initiator if 0) */
  113. #define SCI_MODE_BLOCKDMA    0x80        /* rw: Block-mode DMA handshake (MBZ) */
  114.  
  115.  
  116. /*
  117.  * Target command register
  118.  */
  119.  
  120. #define SCI_TCMD_IO        0x01        /* rw: Assert I/O signal */
  121. #define SCI_TCMD_CD        0x02        /* rw: Assert C/D signal */
  122. #define SCI_TCMD_MSG        0x04        /* rw: Assert MSG signal */
  123. #define SCI_TCMD_PHASE_MASK    0x07        /* r:  Mask for current bus phase */
  124. #define SCI_TCMD_REQ        0x08        /* rw: Assert REQ signal */
  125. #define    SCI_TCMD_LAST_SENT    0x80        /* ro: Last byte was xferred
  126.                          *     (not on 5380/1) */
  127.  
  128. #define    SCI_PHASE(x)        SCSI_PHASE(x)
  129.  
  130. /*
  131.  * Current (SCSI) Bus status
  132.  */
  133.  
  134. #define SCI_BUS_DBP        0x01        /* r:  Data Bus parity */
  135. #define SCI_BUS_SEL        0x02        /* r:  SEL signal */
  136. #define SCI_BUS_IO        0x04        /* r:  I/O signal */
  137. #define SCI_BUS_CD        0x08        /* r:  C/D signal */
  138. #define SCI_BUS_MSG        0x10        /* r:  MSG signal */
  139. #define SCI_BUS_REQ        0x20        /* r:  REQ signal */
  140. #define SCI_BUS_BSY        0x40        /* r:  BSY signal */
  141. #define SCI_BUS_RST        0x80        /* r:  RST signal */
  142.  
  143. #define    SCI_CUR_PHASE(x)    SCSI_PHASE((x)>>2)
  144.  
  145. /*
  146.  * Bus and Status register
  147.  */
  148.  
  149. #define SCI_CSR_ACK        0x01        /* r:  ACK signal */
  150. #define SCI_CSR_ATN        0x02        /* r:  ATN signal */
  151. #define SCI_CSR_DISC        0x04        /* r:  Disconnected (BSY==0) */
  152. #define SCI_CSR_PHASE_MATCH    0x08        /* r:  Bus and SCI_TCMD match */
  153. #define SCI_CSR_INT        0x10        /* r:  Interrupt request */
  154. #define SCI_CSR_PERR        0x20        /* r:  Parity error */
  155. #define SCI_CSR_DREQ        0x40        /* r:  DMA request */
  156. #define SCI_CSR_DONE        0x80        /* r:  DMA count is zero */
  157.  
  158.